/*
 * @Author: wurangkun wurangkun@qq.com
 * @Date: 2023-04-04 19:20:57
 * @LastEditors: wurangkun wurangkun@qq.com
 * @LastEditTime: 2023-05-26 11:55:08
 * @FilePath: \myblog_server\src\moddle\file.ts
 * @Description: 数据模型
 */
import { Sequelize, DataTypes } from 'sequelize';
const sequelize = require("../../mysql")
const file_upload = sequelize.define(
  "file_uploads", // 表名
  {
    // id自动叠加
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      allowNull: true,
      autoIncrement: true,
    },
    type: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    path: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    filename: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    description: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    size: {
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    downloadTimes:{
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    categoryid:{
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    create_time: {
      type: DataTypes.INTEGER,
      allowNull: false,
    },
  },
  {
    timestamps: false, // 不自动生成时间
  },
);
// 导出数据模型model
module.exports = {
  file_upload,
};
